<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource()
 * @ODM\Document(repositoryClass="App\Repository\SalesCutRepository")
 */
class SalesCut
{
    /**
     * @Common(cnName="#",editType="text",listType="text")
     * @ODM\Id(strategy="INCREMENT")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"cut"})
     */
    private $id;

    /**
     * @Common(cnName="每满金额",editType="text",listType="text")
     * @ODM\Field(type="raw", nullable=true)
     * @ORM\Column(type="float")
     * @Groups({"cut"})
     */
    private $price;

    /**
     * @Common(cnName="每升减免",editType="text",listType="text")
     * @ODM\Field(type="raw", nullable=true)
     * @ORM\Column(type="float")
     * @Groups({"cut"})
     */
    private $cut;

    /**
     * @Common(cnName="是否启用",editType="switch",listType="text")
     * @ODM\Field(type="boolean", nullable=true)
     * @ORM\Column(type="boolean", nullable=true)
     * @Groups({"cut"})
     */
    private $isUse;

    /**
     * @Common(cnName="油号",editType="entity",listType="text")
     * @ODM\ReferenceOne(targetDocument="App\Entity\SiteOil")
     * @ORM\ManyToOne(targetEntity="App\Entity\SiteOil")
     * @ORM\JoinColumn(nullable=false)
     * @Groups({"cut"})
     */
    private $oil;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getPrice(): ?float
    {
        return $this->price;
    }

    public function setPrice(float $price): self
    {
        $this->price = $price;

        return $this;
    }

    public function getCut(): ?float
    {
        return $this->cut;
    }

    public function setCut(float $cut): self
    {
        $this->cut = $cut;

        return $this;
    }

    public function getIsUse(): ?bool
    {
        return $this->isUse;
    }

    public function setIsUse(?bool $isUse): self
    {
        $this->isUse = $isUse;

        return $this;
    }

    public function getOil(): ?SiteOil
    {
        return $this->oil;
    }

    public function setOil(SiteOil $oil): self
    {
        $this->oil = $oil;
        return $this;
    }
}
